package com.rd.student.jike.class2.xuezhixin;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;

public class QueueTest {
    public static void main(String[] args) {

        Student lhm = new Student("李宏鸣","计科",2,"描述",20);
        Student xzx = new Student("薛志鑫","计科",2,"描述",19);
        Student whx = new Student("王海鑫","计科",4,"描述",21);
        Student xyy = new Student("夏银银","计科",4,"描述",22);
        Student wxy = new Student("王向阳","计科",5,"描述",23);
        Student wjh = new Student("吴俊豪","计科",5,"描述",24);
        Deque deque = new LinkedList();
        //头插法
        deque.offerFirst(lhm);
        deque.offerFirst(xzx);
        deque.offerFirst(whx);
        //尾插法
        deque.offerLast(xyy);
        deque.offerLast(wxy);
        deque.offerLast(wjh);
        System.out.println(deque);

        //头部取出
        Object obj1 = deque.pollFirst();
        System.out.println(obj1);
        Object obj2 = deque.pollFirst();
        System.out.println(obj2);
        Object obj3 = deque.pollFirst();
        System.out.println(obj3);

        //尾部取出
        Object obj4 = deque.pollLast();
        System.out.println(obj4);
        Object obj5 = deque.pollLast();
        System.out.println(obj5);
        Object obj6 = deque.pollLast();
        System.out.println(obj6);
    }
}

